<script setup lang="ts">
import { $t } from '@/locales';
import InnerViewer from '@/components/custom/file-viewer/InnerViewer.vue';

defineOptions({
  name: 'FileViewerModel'
});

interface Props {
  /** 文件名 */
  previewFileTitle: string;
  /** 文件预览地址 */
  filePreviewUrl: string;
}

const props = defineProps<Props>();

const visible = defineModel<boolean>('visible', {
  default: false
});

const title = props.previewFileTitle + $t('common.fileViewer');
</script>

<template>
  <NModal v-model:show="visible" :title="title" preset="card" class="w-550">
    <NScrollbar class="pr-20px">
      <InnerViewer :url="filePreviewUrl" />
    </NScrollbar>
  </NModal>
</template>
